#include<bits/stdc++.h>
using namespace std;
int b[1000005];
int s=10000,t=10000;
int x=10000,y=10000;
int mn1=10000,mn2=10000,mx1=10000,mx2=10000;
int xx[4]={1,0,-1,0},yy[4]={0,1,0,-1};
char c[3]={'R','B','G'},c2[4]={'D','R','U','L'};
int w[1000005];
string p;
inline int f(int x,int y){
	if(x&1) x--;
	return (x+y)%3;
}
signed main(){
	freopen("snake.in","r",stdin);
	freopen("snake.out","w",stdout);
	cin>>p;
	int n=p.size();
	for(int i=1;i<=n;i++){
		if(p[i-1]=='R') b[i]=0;
		else if(p[i-1]=='B') b[i]=1;
		else b[i]=2;
	}
	int o=0;
	while((b[1]+o)%3!=f(s,t)) o++;
	for(int i=1;i<=n;i++) b[i]=(b[i]+o)%3;
	for(int i=2;i<=n;i++){
		int g1=-1,g2=-1;
		for(int j=0;j<4;j++){
			if(f(x+xx[j],y+yy[j])==b[i]){
				if(g1==-1) g1=j;
				else g2=j;
			}
		}
		if(g2==-1||max(abs(x+xx[g1]-s),abs(y+yy[g1]-t))<=max(abs(x+xx[g2]-s),abs(y+yy[g2]-t))) w[i]=g1;
		else w[i]=g2;
		x=x+xx[w[i]],y=y+yy[w[i]];
		mn1=min(mn1,x);mx1=max(mx1,x);
		mn2=min(mn2,y);mx2=max(mx2,y);
	}
	mx1=mx1-mn1+1;s=s-mn1+1;mn1--;
	mx2=mx2-mn2+1;t=t-mn2+1;mn2--;
	printf("%d %d\n",mx1,mx2);
	for(int i=1;i<=mx1;i++){
		for(int j=1;j<=mx2;j++){
			cout<<c[(f(i+mn1,j+mn2)+3-o)%3];
		}
		printf("\n");
	}
	printf("%d %d\n",s,t);
	for(int i=2;i<=n;i++) cout<<c2[w[i]];
	return 0;
}
